package java_thinking.unit_19._19_11;

import static java_thinking.unit_19._19_11.OutCome.*;

/**
 * @Desc:   19.11.2 使用enum 分发，没看懂
 * @author: cww
 * @DateTime: 2019/5/24 19:20
 */

public enum RoShamBo2 implements Competitor<RoShamBo2>{
    PAPER(DRAW, LOSE, WIN),
    SCISSORS(WIN, DRAW, LOSE),
    ROCK(LOSE,WIN,DRAW);
    private OutCome vPAPER, vSCISSORS, vROCK;
    RoShamBo2(OutCome vPAPER, OutCome vSCISSORS, OutCome vROCK) {
        this.vPAPER = vPAPER;
        this.vSCISSORS = vSCISSORS;
        this.vROCK = vROCK;
    }

    public OutCome compete(RoShamBo2 it) {
        switch (it) {
            default:
            case PAPER: return vPAPER;
            case SCISSORS: return vSCISSORS;
            case ROCK: return vROCK;
        }
    }

    public static void main(String[] args) {
        RoShamBo.play(RoShamBo2.class,20);
    }
}
